package WizardTD.element;

import WizardTD.App;
import lombok.Data;
import processing.core.PApplet;

/**
 * @author HustleLr
 * @version 1.0.0
 */
@Data
public class BloodProcessBar {
    private Monster monster;
    private float currentHp;
    private float x;
    private float y;

    public BloodProcessBar(Monster monster, float x, float y) {
        this.monster = monster;
        this.currentHp = monster.getHp();
        this.x = x;
        this.y = y;
    }


    public void draw(PApplet pApplet) {
        float rectWidth = PApplet.map(this.currentHp, 0, monster.getHp(), 0, App.CELLSIZE);
        pApplet.fill(178, 34, 34);
        pApplet.rect(x, y-5, App.CELLSIZE, 4);
        pApplet.fill(173, 255, 47);
        pApplet.rect(x, y-5, rectWidth, 4);
    }
}
